UpdatableStatesMachine

interface UpdatableStatesMachine<T : State> : StatesMachine<T>

This extender of StatesMachine interface declare one new function updateChain. Realizations of this interface must be able to perform update of chain in internal StatesManager

Functions

handleState
Link copied to clipboard
common
abstract suspend fun StatesMachine<in T>.handleState(state: T): T?

Main handling of state. In case when this state leads to another State and handleState returns not null State it is assumed that chain is not completed.

launchStateHandling
Link copied to clipboard
common
open suspend fun launchStateHandling(state: T, handlers: List<CheckableHandlerHolder<in T, T>>): T?
start
Link copied to clipboard
common
abstract fun start(scope: CoroutineScope): Job

Starts handling of States

startChain
Link copied to clipboard
common
abstract suspend fun startChain(state: T)

Start chain of States witn state

updateChain
Link copied to clipboard
common
abstract suspend fun updateChain(currentState: T, newState: T)

Update chain with current state equal to currentState with newState. Behaviour of this update preforming in cases when currentState does not exist in StatesManager must be declared inside of realization of StatesManager.update function

Inheritors

DefaultUpdatableStatesMachine
Link copied to clipboard